package com.event.example.jpa.service;

import com.event.example.jpa.TagEntity;
import com.event.example.jpa.TagRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description TODO
 * @Author Bing
 * @Date 2024/10/9 14:37
 */
@Service
public class TagJapService {

    @Autowired
    private TagRepository tagRepository;

    public void save(TagEntity tagEntity) {
        System.out.println("threadId : " + Thread.currentThread().getId());
        tagRepository.save(tagEntity);
    }

    public void del(Integer id) {
        tagRepository.deleteById(id);
    }

    public void update(TagEntity tagEntity){
        System.out.println("threadId : " + Thread.currentThread().getId());
        tagRepository.save(tagEntity);
    }

    public TagEntity get(Integer id){
        return tagRepository.findById(id).get();
    }
}